/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author FIRE
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { BasicModel, Page } from '../model/baseModel';

const { adminPath } = useGlobSetting();

export interface ShopProductSell extends BasicModel<ShopProductSell> {
  ctitle?: string; // 活动标题
  simpleContent?: string; // 活动简介
  content?: string; // 活动详情
  picUrl?: string; // 缩略图地址
  beginDate?: string; // 活动开始
  endDate?: string; // 活动结束
  abbName?: string; // 促销包名称
  mainInv?: string; // 主产品
  fprice?: number; // 单价
  fbStatus?: string; // 发布状态
  bclose?: string; // 是否关闭
  closeDate?: string; // 关闭日期
  moq?: number; // 起订量
  shopProductSellInvList?: any[]; // 子表列表
}

export const shopProductSellList = (params?: ShopProductSell | any) =>
  defHttp.get<ShopProductSell>({ url: adminPath + '/shop/sell/shopProductSell/list', params });

export const shopProductSellListData = (params?: ShopProductSell | any) =>
  defHttp.post<Page<ShopProductSell>>({
    url: adminPath + '/shop/sell/shopProductSell/listData',
    params,
  });

export const shopProductSellForm = (params?: ShopProductSell | any) =>
  defHttp.get<ShopProductSell>({ url: adminPath + '/shop/sell/shopProductSell/form', params });

export const shopProductSellSave = (params?: any, data?: ShopProductSell | any) =>
  defHttp.postJson<ShopProductSell>({
    url: adminPath + '/shop/sell/shopProductSell/save',
    params,
    data,
  });

export const shopProductSellDelete = (params?: ShopProductSell | any) =>
  defHttp.get<ShopProductSell>({ url: adminPath + '/shop/sell/shopProductSell/delete', params });

export const updateFbStatus = (params?: any, data?: ShopProductSell | any) =>
  defHttp.postJson<ShopProductSell>({
    url: adminPath + '/shop/sell/shopProductSell/updateFbStatus',
    params,
    data,
  });

export const openOrCloseSell = (params?: any, data?: ShopProductSell | any) =>
  defHttp.postJson<ShopProductSell>({
    url: adminPath + '/shop/sell/shopProductSell/openOrCloseSell',
    params,
    data,
  });
